package com.matt.foundation.vo.nursery;

import com.matt.domain.Classes;
import lombok.Data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * *******************************
 * Created by lch.
 * form com.matt
 * on 2018/11/26
 * *******************************
 */
@Data
public class NurseryScheduleListVo {

    private Date created;

    private List<NurseryScheduleVo> scheduleVos = new ArrayList<NurseryScheduleVo>();

    public static NurseryScheduleListVo of(Date created, List<NurseryScheduleVo> nurseryScheduleVoList){
        NurseryScheduleListVo vo = new NurseryScheduleListVo();
        vo.setCreated(created);
        vo.setScheduleVos(nurseryScheduleVoList);
        return vo;
    }

    public static NurseryScheduleListVo ofNurserySchedule(Date created, List<Classes> classesList){
        NurseryScheduleListVo vo = new NurseryScheduleListVo();
        vo.setCreated(created);
        List<NurseryScheduleVo> scheduleVos = new ArrayList<NurseryScheduleVo>();
        for(Classes classes : classesList){
            scheduleVos.add(NurseryScheduleVo.of(classes.getId(),classes.getName(),0,null,null));
        }
        vo.setScheduleVos(scheduleVos);
        return vo;
    }
}
